<template>
  <div>
    <!-- 小图列表部分 -->
    <ul class="list">
      <li
        v-for="item in imgArr"
        :key="item.id"
        @click="$router.push(`/goods/${item.sp_home_title}`)"
      >
        <img :src="item.sp_home_ico" alt="" />
        <span>{{ item.sp_home_title }}</span>
      </li>
    </ul>
    <!-- <Goods :imgArr='imgArr'/> -->
  </div>
</template>

<script>
// 小图接口
import { BannerApi, GoodsApi } from "@/request/api";
export default {
  data() {
    return {
      imgArr: [],
      imgTrr: [],
    };
  },
  created() {
    BannerApi().then((res) => {
      console.log(res);
      console.log(res.data.data[0]);
      this.imgArr = res.data.data[0];
      console.log(this.imgArr);
      this.imgArr.forEach((item, index) => {
        // console.log(item. sp_home_title);
        this.imgTrr = item.sp_home_title;
        console.log(this.imgTrr);
      });
    });
  },
  // methods: {
  //   Benclick(sp_home_title){
  //     console.log(sp_home_title);
  //     this.$router.push('/goods')
  //   }
  // },
};
</script>
 
<style lang="less" scoped>
.list {
  width: 100vw;
  //   height: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-content: space-around;
  overflow: hidden;
  li {
    width: 20vw;
    // height: 30vw;
    // background-color: pink;
    img {
      width: 15vw;
      height: 15vw;
      margin-top: 3vw;
      margin-left: 3vw;
    }
    span {
      text-align: center;
      margin-left: 7vw;
      display: inline-block;
      margin-top: 3vw;
      color: #000;
      font-size: 1.8vw;
    }
  }
}
</style>